package com.jake.generic;

import java.lang.reflect.ParameterizedType;

public class GenericNeeded<T> {

    public void receiveGeneric() {
        Class<T> tClass = getTClass();
        System.out.println("I have received generic:" + tClass.getSimpleName());
    }

    @SuppressWarnings("unchecked")
    private Class<T> getTClass() {
        return (Class<T>) (((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]);
    }
}
